package com.longcai.service.fuyoupay.impl;

import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.longcai.entity.payment.fuyou.request.ClyjFuyouAgencyPay;
import com.longcai.fenzhuang.fuyou.AgencyPayResponse;
import com.longcai.fenzhuang.fuyou.PayforReq;
import com.longcai.mapper.fuyoupay.ClyjFuyouAgencyPayMapper;
import com.longcai.service.fuyoupay.ClyjFuyouAgencyPayService;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author M
 * @since 2019-04-18
 */
@Service
public class ClyjFuyouAgencyPayServiceImpl extends ServiceImpl<ClyjFuyouAgencyPayMapper, ClyjFuyouAgencyPay> implements ClyjFuyouAgencyPayService {

	@Override
	public ClyjFuyouAgencyPay checkout(JSONObject params) {
		ClyjFuyouAgencyPay cfap=new ClyjFuyouAgencyPay();
		cfap.setOrderno(System.currentTimeMillis()+"");
		cfap.setBankno(params.getString("bankNo"));
		cfap.setCityno(params.getString("cityno"));
		cfap.setBranchnm(params.getString("branchnm"));
		cfap.setAccntnm(params.getString("accntnm"));
		cfap.setAccntno(params.getString("accntno "));
		cfap.setAmt(params.getString("amt"));
		cfap.setEntseq(params.getString("entseq"));
		cfap.setMobile(params.getString("mobile"));
		cfap.setAddDesc(params.getString("addDesc"));
		PayforReq pr = new PayforReq();
		AgencyPayResponse apr = pr.agencyPay(cfap);
		if (apr.getRet().equals("000000")) {
			return cfap;
		}
		return null;
	}

}
